package com.zhiyou100.api.book_demo.pojo;

import java.util.Objects;

//图书类别
public class Category {

    private String id; // 类别编号
    private String name; // 类别名称

    public Category() {
    }

    public Category(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
//        System.out.println("111111");
        if (o == null || getClass() != o.getClass()) return false;
//        System.out.println("222222");
        Category category = (Category) o;
        boolean b = Objects.equals(id.trim(), category.id.trim()) && Objects.equals(name.trim(), category.name.trim());
//        System.out.println("b = " + b);
        return b;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name);
    }

    @Override
    public String toString() {
        return "Category{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
